Option Public
Sub Initialize
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Set db = session.CurrentDatabase
	Dim uiws As New NotesUIWorkspace
	Dim fileCSV As Variant
	'Declare variables to hold data
	Dim PartNum As String
	Dim PartName As String
	Dim Price  As Double
	Dim Orientation As String
	Dim Sex As String
	Dim LastModDate As String
	Dim ComponentList As String
	Dim counter As Integer
	Dim doc As NotesDocument
	counter =0
	'setup file number
	filenum% = Freefile()
	'Ask user for file location	
	fileCSV =  uiws.OpenFileDialog(False, "Choose the CSV file","*.txt" ,"c:\temp")
	'If the user chose a file then process
	If Not Isempty(fileCSV ) Then
		Open fileCSV(0) For Input As filenum%
		Do Until Eof(filenum%)
			'Read a line of data
			Input #filenum%, PartNum, PartName, Price, Sex, Orientation, LastModdate, ComponentList 
			'Create Notes document and write values to it
			Set doc = db.CreateDocument
			With doc
				.PartName = PartName
				.PartNum = PartNum
				.Price = Price
				.Sex = Sex
				.Orientation = Orientation
				.PartsList = Split(ComponentList, ",")
				.LastMod = Cdat(LastModDate)
				.Form = "Part"
			End With
			'save document
			Call doc.save(False, False)
			counter = counter +1
		Loop
		Msgbox "You imported " & counter & " records."
	End If
End Sub